/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Edwin
 */
@Entity
@Table(name = "SONG")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "Song.findByAll", query = "SELECT s FROM Song s WHERE s.SongSoundTrack = :SongSoundTrack"),
//    @NamedQuery(name = "Song.findByTitle", query = "SELECT s FROM Song s WHERE s.SongTitle = :SongTitle"),
//    @NamedQuery(name = "Song.findByDuration", query = "SELECT s FROM Song s WHERE s.SongDuration = :SongDuration"),
//    @NamedQuery(name = "Song.findByArtist", query = "SELECT s FROM Song s WHERE s.SongArtist = :SongArtist"),
//})
public class Song implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="SongID")
    private Long id;
    @Column(name="SongTitle")
    private String title;
    @Column(name="SongDuration")
    private Float duration;
    @JoinColumn(name="SongArtist")
    @ManyToOne
    private Artist artistEntity;
    @JoinColumn(name="SongSoundTrack")
    @ManyToOne
    private Soundtrack soundtrackEntity;

    public Song() {
    }

    public Song(Long id) {
        this.id=id;
    }

    public Artist getArtistEntity() {
        return artistEntity;
    }

    public void setArtistEntity(Artist artistEntity) {
        this.artistEntity = artistEntity;
    }

    public Soundtrack getSoundtrackEntity() {
        return soundtrackEntity;
    }

    public void setSoundtrackEntity(Soundtrack soundtrackEntity) {
        this.soundtrackEntity = soundtrackEntity;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Float getDuration() {
        return duration;
    }

    public void setDuration(Float duration) {
        this.duration = duration;
    }

    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Song)) {
            return false;
        }
        Song other = (Song) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entitys.SongEntity[ id=" + id + " ]";
    }
    
}
